<?php

class File {
	private $_fileHandler;
	const MODE_READ_ONLY="r";
	public function __construct($pathToFile,$mode="r"){
		if (!File::exists($pathToFile)) throw new NoSuchFileException($pathToFile);
		$this->_fileHandler = fopen($pathToFile,$mode);
	}
	
	public function getChar(){
		if (feof($this->_fileHandler)) throw new EndOfFileException();
		return fgetc($this->_fileHandler);
	}
	public function getLine(){
		if (feof($this->_fileHandler)) throw new EndOfFileException();
		return fgets($this->_fileHandler);
	}
	public function getStrippedLine(){
		if (feof($this->_fileHandler)) throw new EndOfFileException();
		return fgetss($this->_fileHandler);
	}
	
	//////// STATIC METHODS ////////
	public static function exists($path){
		return file_exists($path);
	}
	
}

?>